<?php

use Illuminate\Database\Seeder;

class GroupSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return mixed
     */
    public function run()
    {
        DB::table('groups')->insert([
            [
                'group_name' => '系统管理员',
                'description' => '后台管理用户组，系统预置不允许删除',
                'created_at' => date('Y-m-d H:i:s')
            ]
        ]);
        $data = [];
        foreach (DB::table('menus')->get()->pluck('menu_id')->toArray() as $item){
            $data[] = [
                'group_id' => 1,
                'menu_id' => $item
            ];
        }
        return DB::table('bind_group_menu')->insert($data);
    }
}
